package com.example.mananger.handler;

import com.example.base.security.SecurityUtil;
import com.example.base.security.SysUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Slf4j
@Order(-9997)
public class SystemInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        SysUser sysUser= SecurityUtil.getSysUserEntity();
        log.info("system 登录的用户类型: {}",sysUser.getUserType());
        log.info("系统拦截:{}",request.getRequestURI());
        return true;
    }
}
